<div [class.active]="isActive">
    <div *ngIf="!moreLogic">
        <div style="margin-bottom: 10px">
            单场景逻辑: 符合
            <nz-select [(ngModel)]="logicType" name="logicType" style="width: 100px;margin: 0 102px 0 10px" (nzOpenChange)="change($event)">
                <nz-option
                    *ngFor="let option of options"
                    [nzLabel]="option.label"
                    [nzValue]="option">
                </nz-option>
            </nz-select>
            触发:
            <nz-select [(ngModel)]="target" name="target" style="width: 100px;margin: 0 5px" >
                <nz-option
                    *ngFor="let option of targets"
                    [nzLabel]="option.label"
                    [nzValue]="option">
                </nz-option>
            </nz-select>
            <!--<nz-input style="width: 100px;margin: 0 5px;" [nzPlaceHolder]="'请输入跳转目标'" [(ngModel)]="target.value"></nz-input>-->

            <button nz-button [nzType]="'default'" style="margin-left: 30px" (click)="addLand()" [disabled]="disabled" class="mr-sm">
                <span>添加逻辑</span>
            </button>
            <button  nz-button [nzType]="'primary'" (click)="save()" [disabled]="disabled" class="mr-sm">
                <span>确认</span>
            </button>
            <button  nz-button [nzType]="'default'" (click)="deleteAll()" [disabled]="disabled" class="mr-sm">
                <span>清空</span>
            </button>
            <button  nz-button [nzType]="'default'" (click)="toggleLogic()" [disabled]="disabled" class="mr-sm">
                <span>切换</span>
            </button>
        </div>
        <div *ngFor="let data of singleLogicData;let i = index" nz-row style="margin-bottom: 10px">
            当
            <nz-select [(ngModel)]="data.logicScene" name="{{ logicScene +i}}" style="width: 100px;margin: 0 5px" >
                <nz-option
                    *ngFor="let option of scenes"
                    [nzLabel]="option.label"
                    [nzValue]="option">
                </nz-option>
            </nz-select>
            {{n_name}}
            <!--<nz-input style="width: 100px;margin: 0 5px;" [nzPlaceHolder]="'请输入分组'" [(ngModel)]="data.logicScene.value"></nz-input>-->

            <nz-select [(ngModel)]="data.logicCondition" style="width: 100px;margin: 0 5px" (nzOpenChange)="conditionChange($event, i)">
                <nz-option
                    *ngFor="let option of condition"
                    [nzLabel]="option.label"
                    [nzValue]="option">
                </nz-option>
            </nz-select>
            <nz-select *ngIf="data.logicCondition.value ==='select'" [(ngModel)]="data.logicOperation"  style="width: 80px;margin: 0 5px" >
                <nz-option
                    *ngFor="let option of selectOperation"
                    [nzLabel]="option.label"
                    [nzValue]="option">
                </nz-option>
            </nz-select>
            <nz-select *ngIf="data.logicCondition.value ==='review'" [(ngModel)]="data.logicOperation" style="width: 80px;margin: 0 5px" >
                <nz-option
                    *ngFor="let option of operation"
                    [nzLabel]="option.label"
                    [nzValue]="option">
                </nz-option>
            </nz-select>
            <nz-select *ngIf="data.logicCondition.value === 'select'" [(ngModel)]="data.logicResultSelect"  style="width: 80px;margin: 0 5px" >
                <nz-option
                    *ngFor="let option of results"
                    [nzLabel]="option.label"
                    [nzValue]="option">
                </nz-option>
            </nz-select>
            <nz-input-number *ngIf="data.logicCondition.value === 'review'" [(ngModel)]="data.logicResultNumber"  [nzPlaceHolder]="'请输入数值'" style="width: 80px;margin: 0 5px">
            </nz-input-number>
            <button nz-button [nzType]="'danger'" (click)="delete(i)" [disabled]="disabled" class="mr-sm">
                <span>删除</span>
            </button>
        </div>
        <div *ngIf="allLogicData.length !== 0" style="margin-top: 10px;padding-top: 10px;border-top: 1px solid #ccc;">
            已添加逻辑关系
            <div style="padding: 10px 20px">
                <p *ngFor="let data of allLogicData;let i = index" style="padding-bottom: 10px;margin-bottom: 10px">
                    条件 {{i+1}}　当
                    <ng-container *ngFor="let value of data.rules;let i = index">
                        <span *ngIf="i !== 0">{{data.logicType === 'and'? '并且':'或者'}}</span>
                        <!--{{value.logicScene}}-->
                        {{n_name}}
                        {{value.logicCondition === 'select'?'选项':'评论数'}}
                        {{value.logicOperation}}
                        {{value.logicResultSelect || value.logicResultNumber || '0'}}
                    </ng-container>
                    <span>触发 {{data.label}}</span>
                    <button style="margin-left: 20px" nz-button [nzType]="'danger'" (click)="deleteRule(i)" [disabled]="disabled" class="mr-sm">
                        <span>删除</span>
                    </button>
                </p>
            </div>
        </div>
        <div style="margin-top: 10px;padding-top: 10px;border-top: 1px solid #ccc;">
            <button nz-button [nzType]="'default'" (click)="clearAll()" [disabled]="disabled" class="mr-sm">
                <span>清空</span>
            </button>
        </div>
    </div>
    <div *ngIf="moreLogic">
        <div style="margin-bottom: 10px">
            多场景逻辑:
            <!--<nz-input style="width: 100px;margin: 0 5px;" [nzPlaceHolder]="'请输入跳转目标'" [(ngModel)]="target.value"></nz-input>-->
            符合
            <nz-select [(ngModel)]="multiLogicType" name="logicType" style="width: 100px;margin: 0 102px 0 10px;" (nzOpenChange)="change($event)">
                <nz-option
                    *ngFor="let option of options"
                    [nzLabel]="option.label"
                    [nzValue]="option.value">
                </nz-option>
            </nz-select>
            <button nz-button [nzType]="'default'" style="margin-left: 30px" (click)="addMoreLogic()" [disabled]="disabled" class="mr-sm">
                <span>添加逻辑</span>
            </button>
            <button  nz-button [nzType]="'primary'" (click)="save()" [disabled]="disabled" class="mr-sm">
                <span>确认</span>
            </button>
            <button  nz-button [nzType]="'default'" (click)="deleteAll()" [disabled]="disabled" class="mr-sm">
                <span>清空</span>
            </button>
            <button  nz-button [nzType]="'default'" (click)="toggleLogic()" [disabled]="disabled" class="mr-sm">
                <span>切换</span>
            </button>
        </div>
        <div *ngFor="let data of multiLogicData;let i = index" nz-row style="margin-bottom: 10px">
            当分组
            <nz-select [(ngModel)]="data.firstGroup" [nzPlaceHolder]="data.firstGroup.props.group_text"   style="width: 80px;margin: 0 5px" >
                <nz-option
                    *ngFor="let option of processList"
                    [nzLabel]="option.props.group_text"
                    [nzValue]="option">
                </nz-option>
            </nz-select>
            的节点
            <nz-select [(ngModel)]="data.firstScene" [nzPlaceHolder]="data.firstScene.text"    style="width: 80px;margin: 0 5px" >
                <nz-option
                    *ngFor="let option of data.firstGroup.nodes"
                    [nzLabel]="option.text"
                    [nzValue]="option">
                </nz-option>
            </nz-select>
            <nz-select [(ngModel)]="data.firstCondition"   style="width: 60px;margin: 0 5px" >
                <nz-option
                    *ngFor="let option of condition"
                    [nzLabel]="option.label"
                    [nzValue]="option.value">
                </nz-option>
            </nz-select>

            <nz-select *ngIf="data.firstCondition ==='select'" [(ngModel)]="data.logic"  style="width: 80px;margin: 0 5px" >
                <nz-option
                    *ngFor="let option of selectOperation"
                    [nzLabel]="option.label"
                    [nzValue]="option.value">
                </nz-option>
            </nz-select>
            <nz-select *ngIf="data.firstCondition ==='review'" [(ngModel)]="data.logic" style="width: 80px;margin: 0 5px" >
                <nz-option
                    *ngFor="let option of operation"
                    [nzLabel]="option.label"
                    [nzValue]="option.value">
                </nz-option>
            </nz-select>

            分组
            <nz-select [(ngModel)]="data.secondGroup" [nzPlaceHolder]="data.secondGroup.props.group_text"  style="width: 80px;margin: 0 5px" >
                <nz-option
                    *ngFor="let option of processList"
                    [nzLabel]="option.props.group_text"
                    [nzValue]="option">
                </nz-option>
            </nz-select>
            的节点
            <nz-select [(ngModel)]="data.secondScene" [nzPlaceHolder]="data.secondScene.text" style="width: 80px;margin: 0 5px" >
                <nz-option
                    *ngFor="let option of data.secondGroup.nodes"
                    [nzLabel]="option.text"
                    [nzValue]="option">
                </nz-option>
            </nz-select>
            <nz-select [(ngModel)]="data.secondCondition"  style="width: 60px;margin: 0 5px" >
                <nz-option
                    *ngFor="let option of condition"
                    [nzLabel]="option.label"
                    [nzValue]="option.value">
                </nz-option>
            </nz-select> 触发:
            <nz-select [(ngModel)]="data.targetGroup"  [nzPlaceHolder]="data.targetGroup.props.group_text"  style="width: 80px;margin: 0 5px" >
                <nz-option
                    *ngFor="let option of processList"
                    [nzLabel]="option.props.group_text"
                    [nzValue]="option">
                </nz-option>
            </nz-select>
            的节点
            <nz-select [(ngModel)]="data.targetScene" [nzPlaceHolder]="data.targetScene.text"  style="width: 80px;margin: 0 5px" >
                <nz-option
                    *ngFor="let option of data.targetGroup.nodes"
                    [nzLabel]="option.text"
                    [nzValue]="option">
                </nz-option>
            </nz-select>
            <!--<nz-input style="width: 100px;margin: 0 5px;" [nzPlaceHolder]="'请输入分组'" [(ngModel)]="data.logicScene.value"></nz-input>-->
            <button nz-button [nzType]="'danger'" (click)="moreDelete(i)" [disabled]="disabled" class="mr-sm">
                <span>删除</span>
            </button>
        </div>

    </div>
    <div class="toggle-btn" (click)="toggle()">
        逻辑编辑<i class="icon icon-返回-1"></i>
    </div>
</div>
